package com.doge.walknovel.business.reader

import androidx.recyclerview.widget.RecyclerView
import com.doge.walknovel.utils.log

class ReaderAdapterObserver(private val view: RecyclerView) : RecyclerView.AdapterDataObserver() {
    override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
        log("ReaderAdapterObserver onItemRangeRemoved $positionStart $itemCount")
    }

    override fun onChanged() {
        log("ReaderAdapterObserver onChanged")
    }

    override fun onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any?) {
        log("ReaderAdapterObserver onItemRangeChanged $positionStart $itemCount $payload")
        if (positionStart == 0 && itemCount == 1) {
            // pre loading removed
        }
    }

    override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
        log("ReaderAdapterObserver onItemRangeInserted $positionStart $itemCount")
        // pre content added
        if (positionStart == 0 || positionStart == 1) {
        }
    }

    override fun onItemRangeChanged(positionStart: Int, itemCount: Int) {
        log("ReaderAdapterObserver onItemRangeChanged $positionStart $itemCount")
    }

    override fun onItemRangeMoved(fromPosition: Int, toPosition: Int, itemCount: Int) {
        log("ReaderAdapterObserver onItemRangeMoved $fromPosition $toPosition $itemCount")
    }
}